package com.jy.adscm.operation.mscyb.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.jy.adscm.bean.system.JyUser;
import com.jy.adscm.operation.mscyb.bean.JqcpMachineproductinfo;
import com.jy.adscm.operation.mscyb.bean.JqdbMachinepackinginfo;
import com.jy.adscm.operation.mscyb.mapper.mysql.JqcpMachineproductinfoMapper;
import com.jy.adscm.operation.mscyb.service.JqcpMachineproductinfoService;
import com.jy.adscm.system.mapper.mysql.JyUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zyl
 * @since 2018-12-07
 */
@Service
public class JqcpMachineproductinfoServiceImpl extends ServiceImpl<JqcpMachineproductinfoMapper, JqcpMachineproductinfo> implements JqcpMachineproductinfoService {
@Autowired
JyUserMapper jyUserMapper;
    @Override
    public List<JqcpMachineproductinfo> selectByTid(String tid) {
        Wrapper<JqcpMachineproductinfo> wrapper =new EntityWrapper<>();
        wrapper.eq("TID",tid);
        List<JqcpMachineproductinfo> jqcpMachineproductinfos = super.selectList(wrapper);
        for (JqcpMachineproductinfo jqcpMachineproductinfo : jqcpMachineproductinfos) {
            if (jqcpMachineproductinfo.getPerson()!=null && !"".equals(jqcpMachineproductinfo.getPerson())){
                JyUser jyUser = jyUserMapper.selectById(jqcpMachineproductinfo.getPerson());
                jqcpMachineproductinfo.setPersonName(jyUser.getName());
            }
        }
        return jqcpMachineproductinfos;
    }
}
